package com.lagou.controller;

import com.lagou.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
public class PositionController {
    @Autowired
    private PositionService positionService;

    /**
     * 页面跳转
     */
    @GetMapping({"/", "/index"})
    public String index() {
        return "index";
    }

    /**
     * 搜索数据
     */
    @GetMapping("/search/{keyword}/{pageNum}/{pageSize}")
    @ResponseBody
    public List<Map<String, Object>> searchPosition(@PathVariable("keyword") String keyword, @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize) throws Exception {
        return positionService.searchPosition(keyword, pageNum, pageSize);
    }
}
